﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ToDo.Data;
using ToDo.Model;
using ToDo.view.page;

namespace ToDo
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        private List<Model.MenuItemModel> itemList = new List<MenuItemModel>();
        MyDayPage myDayPage = new MyDayPage();
        ImportmentPage importmentPage = new ImportmentPage();
        Schedule schedule = new Schedule();
        ForYou forYou = new ForYou();
        TaskPage taskPage = new TaskPage();
        private List<Model.MenuItemModel> MenuItemList
        {
            get { return itemList; }
            set { itemList = value; }
        }


        public MainWindow()
        {
            InitializeComponent();
            contentControl.Content = new MyDayPage();
            loadMenuItem();
            
        }

        public void loadMenuItem()
        {
            using(SqlConnection sqlConnection = new SqlConnection(LinkSqlServer.source))
            {
                sqlConnection.Open();

            }
            MenuItemList.Add(new MenuItemModel() { MenuIcon = "\xe617", BackGround = "red", MentCount = myDayPage.Count , MenuTitle = "我的一天" });
            MenuItemList.Add(new MenuItemModel() { MenuIcon = "\xe646", BackGround = "green", MentCount = 0, MenuTitle = "重要" });
            MenuItemList.Add(new MenuItemModel() { MenuIcon = "\xe613", BackGround = "pink", MentCount = 0, MenuTitle = "已计划日程" });
            MenuItemList.Add(new MenuItemModel() { MenuIcon = "\xe619", BackGround = "blue",MentCount = 0, MenuTitle = "已分配给你" });
            MenuItemList.Add(new MenuItemModel() { MenuIcon = "\xe610", BackGround = "purple", MentCount = 0, MenuTitle = "任务" });
            MenuListBox.ItemsSource = MenuItemList;
            MenuListBox.SelectedIndex = 0;
        }

        private void MenuListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            switch (MenuListBox.SelectedIndex)
            {
                case 0:
                    contentControl.Content = myDayPage;
                    break;
                case 1:
                    contentControl.Content = importmentPage;
                    break;
                case 2:
                    contentControl.Content = schedule;
                    break;
                case 3:
                    contentControl.Content = forYou;
                    break;
                case 4:
                    contentControl.Content = taskPage;
                    break;
            }
        }
    }
}
